package com.bingo.oauth.config;

import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Component
public class LogoutSuccessHandler implements org.springframework.security.web.authentication.logout.LogoutSuccessHandler {
    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
        String redirect_uri = request.getParameter("redirect_uri");
        if (!StringUtils.isEmpty(redirect_uri)) {
            System.out.println("重定向："+redirect_uri);
            response.sendRedirect(redirect_uri);
        }
    }
}
